Codify MCP tool name requirements and add title#152
Conversation
Co-authored-by: Dominic Farolino <domfarolino@gmail.com>
|
First of all: Apologies for wasting your time and thank you for being kind about it. Sincerely hope I did better this time 😅. Anyway, I included the checks in the |
domfarolino
left a comment
There was a problem hiding this comment.
Don't sweat it, specs are hard! Thanks for the contribution.
|
I've pushed a couple small changes to make this more spec idiomatic. Can you take a look @DavidMulder0? |
|
Thank you! Just fixed a typo and a missing verb. |
domfarolino
left a comment
There was a problem hiding this comment.
Thanks a lot! I've prepared https://crrev.com/c/7744064 and https://crrev.com/c/7742044 to implement these changes in Chromium, and provide web platform tests for them.
SHA: 1380910 Reason: push, by domfarolino Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
The spec PR webmachinelearning/webmcp#152 is tightening tool name validation to match what the MCP specification accepts [1], and we think it's reasonable for the web platform to throw exceptions when tool names do not match this criteria, which is what this CL does. [1]: https://modelcontextprotocol.io/specification/2025-11-25/server/tools#tool-names R=masonf Bug: 489045948 Change-Id: I7d1af5d8cd18e5be7db5ddc9f9ce6d28e73cfd3f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7744064 Commit-Queue: Dominic Farolino <dom@chromium.org> Reviewed-by: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#1625865}
The spec PR webmachinelearning/webmcp#152 is tightening tool name validation to match what the MCP specification accepts [1], and we think it's reasonable for the web platform to throw exceptions when tool names do not match this criteria, which is what this CL does. [1]: https://modelcontextprotocol.io/specification/2025-11-25/server/tools#tool-names R=masonf Bug: 489045948 Change-Id: I7d1af5d8cd18e5be7db5ddc9f9ce6d28e73cfd3f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7744064 Commit-Queue: Dominic Farolino <dom@chromium.org> Reviewed-by: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#1625865}
The spec PR webmachinelearning/webmcp#152 is tightening tool name validation to match what the MCP specification accepts [1], and we think it's reasonable for the web platform to throw exceptions when tool names do not match this criteria, which is what this CL does. [1]: https://modelcontextprotocol.io/specification/2025-11-25/server/tools#tool-names R=masonf Bug: 489045948 Change-Id: I7d1af5d8cd18e5be7db5ddc9f9ce6d28e73cfd3f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7744064 Commit-Queue: Dominic Farolino <dom@chromium.org> Reviewed-by: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#1625865}
…a=testonly Automatic update from web-platform-tests WebMCP: Implement tool name validation The spec PR webmachinelearning/webmcp#152 is tightening tool name validation to match what the MCP specification accepts [1], and we think it's reasonable for the web platform to throw exceptions when tool names do not match this criteria, which is what this CL does. [1]: https://modelcontextprotocol.io/specification/2025-11-25/server/tools#tool-names R=masonf Bug: 489045948 Change-Id: I7d1af5d8cd18e5be7db5ddc9f9ce6d28e73cfd3f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7744064 Commit-Queue: Dominic Farolino <dom@chromium.org> Reviewed-by: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#1625865} -- wpt-commits: 65569c07f589a015f3dd697ab1c75703f63a3920 wpt-pr: 59676
…a=testonly Automatic update from web-platform-tests WebMCP: Implement tool name validation The spec PR webmachinelearning/webmcp#152 is tightening tool name validation to match what the MCP specification accepts [1], and we think it's reasonable for the web platform to throw exceptions when tool names do not match this criteria, which is what this CL does. [1]: https://modelcontextprotocol.io/specification/2025-11-25/server/tools#tool-names R=masonf Bug: 489045948 Change-Id: I7d1af5d8cd18e5be7db5ddc9f9ce6d28e73cfd3f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7744064 Commit-Queue: Dominic Farolino <domchromium.org> Reviewed-by: Mason Freed <masonfchromium.org> Cr-Commit-Position: refs/heads/main{#1625865} -- wpt-commits: 65569c07f589a015f3dd697ab1c75703f63a3920 wpt-pr: 59676 UltraBlame original commit: 6eb3c437e9fdfdf332b870a99a0de6f262548087
…a=testonly Automatic update from web-platform-tests WebMCP: Implement tool name validation The spec PR webmachinelearning/webmcp#152 is tightening tool name validation to match what the MCP specification accepts [1], and we think it's reasonable for the web platform to throw exceptions when tool names do not match this criteria, which is what this CL does. [1]: https://modelcontextprotocol.io/specification/2025-11-25/server/tools#tool-names R=masonf Bug: 489045948 Change-Id: I7d1af5d8cd18e5be7db5ddc9f9ce6d28e73cfd3f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7744064 Commit-Queue: Dominic Farolino <domchromium.org> Reviewed-by: Mason Freed <masonfchromium.org> Cr-Commit-Position: refs/heads/main{#1625865} -- wpt-commits: 65569c07f589a015f3dd697ab1c75703f63a3920 wpt-pr: 59676 UltraBlame original commit: 6eb3c437e9fdfdf332b870a99a0de6f262548087
…a=testonly Automatic update from web-platform-tests WebMCP: Implement tool name validation The spec PR webmachinelearning/webmcp#152 is tightening tool name validation to match what the MCP specification accepts [1], and we think it's reasonable for the web platform to throw exceptions when tool names do not match this criteria, which is what this CL does. [1]: https://modelcontextprotocol.io/specification/2025-11-25/server/tools#tool-names R=masonf Bug: 489045948 Change-Id: I7d1af5d8cd18e5be7db5ddc9f9ce6d28e73cfd3f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7744064 Commit-Queue: Dominic Farolino <domchromium.org> Reviewed-by: Mason Freed <masonfchromium.org> Cr-Commit-Position: refs/heads/main{#1625865} -- wpt-commits: 65569c07f589a015f3dd697ab1c75703f63a3920 wpt-pr: 59676 UltraBlame original commit: 6eb3c437e9fdfdf332b870a99a0de6f262548087
Per webmachinelearning/webmcp#152, this CL implements the `title` property for registered tools, consistent with MCP's tool definition [1]. This is done by adding a new `title` property to the `ModelContextTool` dictionary for imperative tools, and a new `tooltitle` attribute for declarative tools. A subsequent spec PR will be made to spec the `getTools()` API and the reflect the fact that `RegisteredTool#title` is always non-undefined, and is the empty string when not provided on registration time, per some discussion we had about the right API shape. [1]: https://modelcontextprotocol.io/specification/2025-11-25/server/tools#tool R=masonf Bug: 489045948 Change-Id: If848ba85ba1b4aeaa39834eca11ba91108e493c0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7742044 Commit-Queue: Dominic Farolino <dom@chromium.org> Reviewed-by: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#1636305}
Per webmachinelearning/webmcp#152, this CL implements the `title` property for registered tools, consistent with MCP's tool definition [1]. This is done by adding a new `title` property to the `ModelContextTool` dictionary for imperative tools, and a new `tooltitle` attribute for declarative tools. A subsequent spec PR will be made to spec the `getTools()` API and the reflect the fact that `RegisteredTool#title` is always non-undefined, and is the empty string when not provided on registration time, per some discussion we had about the right API shape. [1]: https://modelcontextprotocol.io/specification/2025-11-25/server/tools#tool R=masonf Bug: 489045948 Change-Id: If848ba85ba1b4aeaa39834eca11ba91108e493c0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7742044 Commit-Queue: Dominic Farolino <dom@chromium.org> Reviewed-by: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#1636305}
Per webmachinelearning/webmcp#152, this CL implements the `title` property for registered tools, consistent with MCP's tool definition [1]. This is done by adding a new `title` property to the `ModelContextTool` dictionary for imperative tools, and a new `tooltitle` attribute for declarative tools. A subsequent spec PR will be made to spec the `getTools()` API and the reflect the fact that `RegisteredTool#title` is always non-undefined, and is the empty string when not provided on registration time, per some discussion we had about the right API shape. [1]: https://modelcontextprotocol.io/specification/2025-11-25/server/tools#tool R=masonf Bug: 489045948 Change-Id: If848ba85ba1b4aeaa39834eca11ba91108e493c0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7742044 Commit-Queue: Dominic Farolino <dom@chromium.org> Reviewed-by: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#1636305}
Automatic update from web-platform-tests WebMCP: Implement tool title Per webmachinelearning/webmcp#152, this CL implements the `title` property for registered tools, consistent with MCP's tool definition [1]. This is done by adding a new `title` property to the `ModelContextTool` dictionary for imperative tools, and a new `tooltitle` attribute for declarative tools. A subsequent spec PR will be made to spec the `getTools()` API and the reflect the fact that `RegisteredTool#title` is always non-undefined, and is the empty string when not provided on registration time, per some discussion we had about the right API shape. [1]: https://modelcontextprotocol.io/specification/2025-11-25/server/tools#tool R=masonf Bug: 489045948 Change-Id: If848ba85ba1b4aeaa39834eca11ba91108e493c0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7742044 Commit-Queue: Dominic Farolino <dom@chromium.org> Reviewed-by: Mason Freed <masonf@chromium.org> Cr-Commit-Position: refs/heads/main@{#1636305} -- wpt-commits: 1c47dcf8471584f1a9e9fae37ca616cf593b125e wpt-pr: 60179
Automatic update from web-platform-tests WebMCP: Implement tool title Per webmachinelearning/webmcp#152, this CL implements the `title` property for registered tools, consistent with MCP's tool definition [1]. This is done by adding a new `title` property to the `ModelContextTool` dictionary for imperative tools, and a new `tooltitle` attribute for declarative tools. A subsequent spec PR will be made to spec the `getTools()` API and the reflect the fact that `RegisteredTool#title` is always non-undefined, and is the empty string when not provided on registration time, per some discussion we had about the right API shape. [1]: https://modelcontextprotocol.io/specification/2025-11-25/server/tools#tool R=masonf Bug: 489045948 Change-Id: If848ba85ba1b4aeaa39834eca11ba91108e493c0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7742044 Commit-Queue: Dominic Farolino <domchromium.org> Reviewed-by: Mason Freed <masonfchromium.org> Cr-Commit-Position: refs/heads/main{#1636305} -- wpt-commits: 1c47dcf8471584f1a9e9fae37ca616cf593b125e wpt-pr: 60179 UltraBlame original commit: d752cced038d4d6b4fe4f50c38e9730279ce043b
Automatic update from web-platform-tests WebMCP: Implement tool title Per webmachinelearning/webmcp#152, this CL implements the `title` property for registered tools, consistent with MCP's tool definition [1]. This is done by adding a new `title` property to the `ModelContextTool` dictionary for imperative tools, and a new `tooltitle` attribute for declarative tools. A subsequent spec PR will be made to spec the `getTools()` API and the reflect the fact that `RegisteredTool#title` is always non-undefined, and is the empty string when not provided on registration time, per some discussion we had about the right API shape. [1]: https://modelcontextprotocol.io/specification/2025-11-25/server/tools#tool R=masonf Bug: 489045948 Change-Id: If848ba85ba1b4aeaa39834eca11ba91108e493c0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7742044 Commit-Queue: Dominic Farolino <domchromium.org> Reviewed-by: Mason Freed <masonfchromium.org> Cr-Commit-Position: refs/heads/main{#1636305} -- wpt-commits: 1c47dcf8471584f1a9e9fae37ca616cf593b125e wpt-pr: 60179 UltraBlame original commit: d752cced038d4d6b4fe4f50c38e9730279ce043b
Automatic update from web-platform-tests WebMCP: Implement tool title Per webmachinelearning/webmcp#152, this CL implements the `title` property for registered tools, consistent with MCP's tool definition [1]. This is done by adding a new `title` property to the `ModelContextTool` dictionary for imperative tools, and a new `tooltitle` attribute for declarative tools. A subsequent spec PR will be made to spec the `getTools()` API and the reflect the fact that `RegisteredTool#title` is always non-undefined, and is the empty string when not provided on registration time, per some discussion we had about the right API shape. [1]: https://modelcontextprotocol.io/specification/2025-11-25/server/tools#tool R=masonf Bug: 489045948 Change-Id: If848ba85ba1b4aeaa39834eca11ba91108e493c0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7742044 Commit-Queue: Dominic Farolino <domchromium.org> Reviewed-by: Mason Freed <masonfchromium.org> Cr-Commit-Position: refs/heads/main{#1636305} -- wpt-commits: 1c47dcf8471584f1a9e9fae37ca616cf593b125e wpt-pr: 60179 UltraBlame original commit: d752cced038d4d6b4fe4f50c38e9730279ce043b
Addressing #145 and #133 .
(Related topic: some guidance regarding localization would be great.
namedoes not have to be localized presumably (it won't be shown to the user presumably).titlemay be localized. Willdescriptionbe shown to the end user? From personal experience I am treating that as a solid 'no' (all MCP descriptions I have written so far were 'prompt engineered'). Lastly I have seen the tool arguments get presented to the user relatively often, so should there be a way to localize the display of those?)